﻿using System;

namespace Xwltz.Net.Tools.Browser
{
    public class Chrome : BaseBrowser
    {
        public Chrome(string agent)
        {
            var agent1 = agent.ToLower();
            var chrome = BrowserType.Chrome.ToString().ToLower();

            if (!agent1.Contains(chrome)) return;
            var first = agent1.IndexOf(chrome, StringComparison.Ordinal);
            var cut = agent1.Substring(first + chrome.Length + 1);
            var version = cut.Substring(0, cut.IndexOf(' '));
            Version = ToVersion(version);
            Type = BrowserType.Chrome;
        }
    }
}
